package com.simple.llm.service;


import com.github.zuihou.base.R;
import com.simple.llm.domain.dto.LLMStreamResultDTO;
import com.simple.llm.domain.dto.NormalChatDTO;
import com.simple.llm.domain.dto.StreamChatDTO;
import com.simple.llm.domain.vo.LLMResponseVO;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;

import javax.servlet.http.HttpServletResponse;
import java.util.function.Consumer;

public interface LLMStrategy {
    /**
     * 普通对话
     */
    R<LLMResponseVO> chat(NormalChatDTO normalChatDTO);

    /**
     * 流式对话
     * @param streamChatDTO 请求内容
     * @param response 响应对象
     * @param resultHandler 最终响应处理回调
     */
    ResponseBodyEmitter streamChat(StreamChatDTO streamChatDTO, HttpServletResponse response, Consumer<LLMStreamResultDTO> resultHandler);

}
